Invoicing Example

File: Invoice.cln

Introduction

This example shows how to mix calculation and database objects together in a mixed application. The result is sent directly to the printer when the sheet is recalculated and for this reason it is best to switch off automatic recalculation when using this it (otherwise every change you make will result in a printout).

Scenario

This sheet represents a companies stock list. The company sells Gammax at £82.50 per unit, Betamax at £89.10 per Unit and Lomax at £44.30 a unit and so on.

A customer orders a list of items and the quantity of each item. This sheet first looks up the item in the stock list, calculates the cost of each item, the Vat (local taxes) to add to each item and finally totals up the result and adds on a delivery charge.

The finished table is sent to a Hard Copy object for printing.

The Sheet in Detail

Order	The Order is the list of items ordered by the customer and the number of each he requires. Notice that you do not need to get the names exactly correct - CleanSheet uses the Lookup Object's nearest option to find the best match for each name.

Vat/No Vat	These buttons selects whether this is an order onto which vat should be added, or an export order where Vat doesn't apply.

Products	This is the list of Products sold by our company. The first column contains the names, the second column contains the price excluding Vat and the third column lists the amount of Vat to add.

Delivery Costs	This is our companies delivery charge and Vat rate for delivery

Using the Sheet

Enter the names and quantities of the products ordered into the 'Order' Table, this has been sized to allow 4 entries, if you want more, switch to Edit Mode and resize the input table to allow for more entries.

You can leave blank entries in this table, they will not affect the total

The product names are entered as strings (in double quotes) you do not need to be exact, this sheet will choose the nearest match.

Enter the quantity in the adjacent cell, if you leave it blank it counts as 0 units

Select Vat or No Vat according to whether this is an export order with no Vat to add, or a order to which Vat applies

Click on Manual Recalculation to recalculate the sheet.

The sheet will print out a table which shows the order, the Vat and delivery charge, this should be printed on letter headed paper.

Modifying the Sheet

You can modify this sheet to include your own sales items.

Change the size of the Product table by selecting it, switch to Edit Mode and using 'Number of Rows/Columns' on the Object menu, set sufficient rows to list all your products.

Switch to Use Mode and enter the data for your products, the price excluding Vat and the rate of Vat applicable.

Enter your standard delivery charge and the rate of Vat that applies to the delivery.

You can now use the sheet, the sheet is self adjusting, so you do not have to modify the calculation to suit the quantity of data.